
#include "view_time_10.h"
#include "view_time_10.inc"
#include "view_time_0.h"
#include "display_ctrl.h"
#include "platform_assert.h"
#include "lfs_file_manager_auto.h"
#include "rtc.h"
#include "datetime.h"
#include "blecom.h"
#include "battery_ctrl.h"
#include "sport_his.h"
#include "display_ctrl.h"
#include "display_interface_240x240.h"
#include "datetime.h"
#include "heart_rate_interface.h"
#include "font/num_font.h"
#include "font_mngr.h"
#include "view_common.h"
#include "app_trace.h"
#include "view_times.h"
#include "view_time_8.h"
#include "math.h"
#include "weather_ctrl.h"
#ifdef TIME_10_SKIP
#else
//       disp_ctrl.com_data.i_temp[16]  calorie
//  disp_ctrl.com_data.i_temp[11]   step

void view_time_10_display(void)
{

    _disp_show_flash_img(DISP_LFS_FILE_INDEX_5, 0, 0, FILE_IMG_t301_back_0_0);
    show_time_0_battery(disp_ctrl.com_data.i_temp[7], disp_ctrl.com_data.i_temp[8]);
    show_time_0_ble();

    int x = 114;
    int y = 28;
    disp_draw_user_image_num_with_digits_filter_color(x, y, disp_ctrl.com_data.i_temp[3], 2, 26, num_24x30_TAB);
    x += 56;
    disp_draw_user_image_filter_color(x, y, t302_time_second_124_28);
    x += 13;
    disp_draw_user_image_num_with_digits_filter_color(x, y, disp_ctrl.com_data.i_temp[4], 2, 26, num_24x30_TAB);
#ifdef ITALIAN_DATE_ON_TIME
    int month = disp_ctrl.com_data.i_temp[1] - 1;
    int day = disp_ctrl.com_data.i_temp[2];
    int weeks = disp_ctrl.com_data.i_temp[5] - 1;
    uint8_t const *icon_month = italian_moon_TAB[month];
    uint8_t const *icon_week = italian_week_TAB[weeks];
#if 1
    uint16_t const base_color = RGB565_COLOR_WHITE;
#else
    uint16_t const base_color = 0xe720;
#endif
    int date_x = 120;
    int date_y = 66;
    disp_draw_user_image_filter_color_gray_lucency(date_x, date_y, icon_month, base_color);
    date_x += icon_month[0] + (icon_month[1] << 8) + 3;
    disp_draw_user_image_filter_color_gray_lucency(date_x, date_y, slash_8x15, base_color);
    date_x += slash_8x15[0] + (slash_8x15[1] << 8) + 3;
    disp_draw_user_image_filter_color_gray_lucency(date_x, date_y, num_11x15_TAB[day / 10], base_color);
    date_x += num_11x15_TAB[0][0] + (num_11x15_TAB[0][1] << 8) + 1;
    disp_draw_user_image_filter_color_gray_lucency(date_x, date_y, num_11x15_TAB[day % 10], base_color);
    date_x += num_11x15_TAB[0][0] + (num_11x15_TAB[0][1] << 8) + 3;
    disp_draw_user_image_filter_color_gray_lucency(date_x, date_y, icon_week, base_color);
    date_x += icon_week[0] + (icon_week[1] << 8) + 1;

    int const heart_rate_num_width = 16;
    int const heart_rate_num_height = 18;
    int const heart_rate_num_interval = 1;
    int const heart_rate_start_x = 45;
    int heart_rate_draw_x = heart_rate_start_x;
    int const heart_rate_draw_y = 157;
    if (disp_ctrl.com_data.i_temp[17] < 40 || disp_ctrl.com_data.i_temp[17] > 220)
    {
        disp_draw_rect_color(heart_rate_draw_x, heart_rate_draw_y + heart_rate_num_height / 2 - 3, heart_rate_draw_x + heart_rate_num_width - 1, heart_rate_draw_y + heart_rate_num_height / 2 - 1,
                             RGB565_COLOR_WHITE);
        heart_rate_draw_x += heart_rate_num_width + heart_rate_num_interval;
        disp_draw_rect_color(heart_rate_draw_x, heart_rate_draw_y + heart_rate_num_height / 2 - 3, heart_rate_draw_x + heart_rate_num_width - 1, heart_rate_draw_y + heart_rate_num_height / 2 - 1,
                             RGB565_COLOR_WHITE);
    }
    else
    {
        disp_draw_user_image_num_filter_color(heart_rate_draw_x, heart_rate_draw_y, disp_ctrl.com_data.i_temp[17], heart_rate_num_width + heart_rate_num_interval, num_16x18_TAB);
    }
    view_time_show_temperature_float(45, 196, disp_ctrl.com_data.f_temp[26], disp_ctrl.com_data.i_temp[21] == WEATHER_TEMPERATURE_TYPE_C, false);

#else
#ifdef TIME_NO_WRIST_TEMPERATURE
    view_time_show_temperature_float(39, 208, disp_ctrl.com_data.f_temp[26], disp_ctrl.com_data.i_temp[21] == WEATHER_TEMPERATURE_TYPE_C, false);
#else
    view_time_show_temperature_float(39, 155, disp_ctrl.com_data.f_temp[26], disp_ctrl.com_data.i_temp[21] == WEATHER_TEMPERATURE_TYPE_C, false);
    view_time_show_temperature_float(39, 208, disp_ctrl.com_data.f_temp[25], disp_ctrl.com_data.i_temp[21] == WEATHER_TEMPERATURE_TYPE_C, false);
#endif
    disp_draw_user_image_num_filter_color(184, 73, disp_ctrl.com_data.i_temp[17], 17, num_16x18_TAB);
#endif
}
#endif
